package com.lancoo.answer.widget;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.util.Log;

import com.lancoo.answer.util.DpUtils;

/**
 * Created by pengmi on 2019/1/10.
 * Description:
 */

public class RichTxtUrlDrawable extends BitmapDrawable {

    public RichTxtUrlDrawable(Bitmap bitmap, Context mContext){
        this.bitmap=bitmap;
        this.mContext=mContext;
    }

    private Bitmap bitmap;
    private Context mContext;



    @Override
    public void draw(Canvas canvas) {
        super.draw(canvas);
        if (bitmap != null) {
            int i = canvas.getWidth() - bitmap.getWidth();
            Log.e("aaaa","bitmap:"+bitmap.getWidth()+"..."+bitmap.getHeight());
            Log.e("aaaa","canvas:"+canvas.getWidth()+"..."+canvas.getHeight());
            canvas.drawBitmap(bitmap, 0, -DpUtils.dip2px(mContext,9), getPaint());
        }
    }

    public void setBitmap(Bitmap bitmap) {
        this.bitmap = bitmap;
    }
}